package xdu.lz.beanlife;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 *
 * 自定义的事件类型，嵌入到Spring源码发布
 * @date 2020/5/24 22:06
 */
public class MyListener implements ApplicationListener {
	@Override
	public void onApplicationEvent(ApplicationEvent event) {
		if(event instanceof ContextRefreshedEvent){
			System.out.println("【context刷新完毕 ,listener监听器回调了】");
		}

		if(event instanceof BeanPostProcessorsRegisterDoneEvent){
			System.out.println("【自定义的事件，自定义发布======】");
		}
		if(event instanceof ContextClosedEvent){
			System.out.println("【context关闭了 ,listener监听器回调了】");
		}

	}
}
